
/* makepro.c by bill buckels 1990 */
/* makes a prodos sys program     */


#include <stdio.h>
#include <io.h>

int bitcopy(char *name1, char *name2)
{
    FILE *fp,*fp2;
    unsigned char c;

    long target,count=0;
    if((fp=fopen(name1,"rb"))==NULL){
                                     perror("Sorry..");
                                     return -1;
                                     }
    fp2=fopen(name2,"wb");
    target=filelength(fileno(fp));


    while(count<target)
        {
        c=fgetc(fp);
        if(count>3)fputc(c,fp2);
        count++;
        }
    fclose(fp);
    fclose(fp2);

   return(0);
}


main(int argc, char *argv[])
{
    char buf[66];

    if(argc==2)
    {
    sprintf(buf,"%s.SYS",argv[1]);
    bitcopy(argv[1],buf);
    }
    else
    {
        printf(
        "Usage is [MANX C65 EXECUTABLE PRODOS SYS FILE- NO EXTENSION]\n");
    }
    exit(0);
}

